package com.i2863.shiroDemo.dto;

import lombok.Data;

import java.io.Serializable;

/**
 * @author cexy
 * @date 2021/5/17 10:26
 * @description: 数据返回格式
 */
@Data
public class ResultInfo<T> implements Serializable {

    private static final long serialVersionUID = -5027314771806549953L;

    public ResultInfo() {
    }

    public ResultInfo(T data) {
        this.data = data;
    }

    public ResultInfo(T data, long count) {
        this.data = data;
        this.count = count;
    }

    public ResultInfo(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ResultInfo(String msg) {
        this.code = 1;
        this.msg = msg;
    }

    public ResultInfo(T data, int code, String msg) {
        this.data = data;
        this.code = code;
        this.msg = msg;
    }

    public ResultInfo(T data, Integer count, int code, String msg) {
        this.data = data;
        this.count = count;
        this.code = code;
        this.msg = msg;
    }

    public ResultInfo(T data, long count, int code, String msg) {
        this.data = data;
        this.count = count;
        this.code = code;
        this.msg = msg;
    }


    /**
     * 错误信息
     */
    private String msg;
    /**
     * 错误号
     */
    private int code = 200;
    /**
     * 返回数据
     */
    private T data;
    /**
     * 总记录数
     */
    private long count;

}